<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
<meta charset="utf-8">
<title>{:C('SITE_NAME')}_管理后台</title>
<link href="__CSS__/skin_0.css" rel="stylesheet" type="text/css" id="cssfile"/>
<script type="text/javascript" SRC="__JS__/jquery.js"></script>
<script type="text/javascript" src="__JS__/jquery.validation.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.cookie.js"></script>
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="__JS__/html5shiv.js"></script>
      <script src="__JS__/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
	$(document).ready(function () {
	    $('span.bar-btn').click(function () {
			$('ul.bar-list').toggle('fast');
	    });
	});

	$(document).ready(function(){
		var pagestyle = function() {
			var iframe = $("#workspace");
			var h = $(window).height() - iframe.offset().top;
			var w = $(window).width() - iframe.offset().left;
			if(h < 300) h = 300;
			if(w < 973) w = 973;
			iframe.height(h);
			iframe.width(w);
		}
		pagestyle();
		$(window).resize(pagestyle);
		if($.cookie('now_location_act') != null){
			openItem($.cookie('now_location_op')+','+$.cookie('now_location_act')+','+$.cookie('now_location_nav'));
		}else{
			$('#mainMenu>ul').first().css('display','block');
			$('#item_welcome').addClass('selected');			
			$('#workspace').attr('src','/admin/index/welcome/');
		}
		$('#iframe_refresh').click(function(){
			var fr = document.frames ? document.frames("workspace") : document.getElementById("workspace").contentWindow;;
			fr.location.reload();
		});
	
	});

	function addBookmark(url, label) {
	    if (document.all){
	        window.external.addFavorite(url, label);
	    }
	    else if (window.sidebar){
	        window.sidebar.addPanel(label, url, '');
	    }
	}

	function openItem(args){
	    closeBg();
		if($.cookie('by_sys_key') === null){
			location.href = '/admin/login/login';
			return false;
		}
		spl = args.split(',');
		op  = spl[0];
		try {
			act = spl[1];
			nav = spl[2];
		}
		catch(ex){}
		if (typeof(act)=='undefined'){var nav = args;}
		$('.actived').removeClass('actived');
		$('#nav_'+nav).addClass('actived');
		$('.selected').removeClass('selected');	
		$('#mainMenu ul').css('display','none');
		$('#sort_'+nav).css('display','block');	
	
		if (typeof(act)=='undefined'){
			html = $('#sort_'+nav+'>li>dl>dd>ol>li').first().html();
			str = html.match(/openItem\('(.*)'\)/ig);
			arg = str[0].split("'");
			spl = arg[1].split(',');
			op  = spl[0];
			act = spl[1];
			nav = spl[2];
			first_obj = $('#sort_'+nav+'>li>dl>dd>ol>li').first().children('a');
			$(first_obj).addClass('selected');		
			$('#crumbs').html('<span>'+$('#nav_'+nav+' > span').html()+'</span><span class="arrow">&nbsp;</span><span>'+$(first_obj).text()+'</span>');		
		}else{
			$.cookie('now_location_nav',nav);
			$.cookie('now_location_act',act);
			$.cookie('now_location_op',op);
			$("a[name='item_"+op+act+"']").addClass('selected');
			$('#crumbs').html('<span>'+$('#nav_'+nav+' > span').html()+'</span><span class="arrow">&nbsp;</span><span>'+$('#item_'+op+act).html()+'</span>');
		}
		src = '/admin/'+act+'/'+op;
		$('#workspace').attr('src',src);
	}

	$(function() {
		bindAdminMenu();
	})
	function bindAdminMenu() {
		$("[nc_type='parentli']").click(function() {
			var key = $(this).attr('dataparam');
			if ($(this).find("dd").css("display") == "none") {
				$("[nc_type='" + key + "']").slideDown("fast");
				$(this).find('dt').css("background-position", "-322px -170px");
				$(this).find("dd").show();
			} else {
				$("[nc_type='" + key + "']").slideUp("fast");
				$(this).find('dt').css("background-position", "-483px -170px");
				$(this).find("dd").hide();
			}
		});
	}
</script>
<script type="text/javascript"> 
	function showBg(ct, content) {
		var bH = $("body").height();
		var bW = $("body").width();
		var objWH = getObjWh(ct);
		$("#pagemask").css({ width : bW, height : bH, display : "none" });
		var tbT = objWH.split("|")[0] + "px";
		var tbL = objWH.split("|")[1] + "px";
		$("#" + ct).css({ top : tbT, left : tbL, display : "block" });
		$(window).scroll(function() { resetBg() });
		$(window).resize(function() { resetBg() });
	}
	function getObjWh(obj) {
		var st = document.documentElement.scrollTop;//滚动条距顶部的距离 
		var sl = document.documentElement.scrollLeft;//滚动条距左边的距离 
		var ch = document.documentElement.clientHeight;//屏幕的高度 
		var cw = document.documentElement.clientWidth;//屏幕的宽度 
		var objH = $("#" + obj).height();//浮动对象的高度 
		var objW = $("#" + obj).width();//浮动对象的宽度 
		var objT = Number(st) + (Number(ch) - Number(objH)) / 2;
		var objL = Number(sl) + (Number(cw) - Number(objW)) / 2;
		return objT + "|" + objL;
	}
	
	function resetBg() {
		var fullbg = $("#pagemask").css("display");
		if (fullbg == "block") {
			var bH2 = $("body").height();
			var bW2 = $("body").width();
			$("#pagemask").css({ width : bW2, height : bH2 });
			var objV = getObjWh("dialog");
			var tbT = objV.split("|")[0] + "px";
			var tbL = objV.split("|")[1] + "px";
			$("#dialog").css({ top : tbT, left : tbL });
		}
	}
	
	function closeBg() {
		$("#pagemask").css("display", "none");
		$("#dialog").css("display", "none");
	}
</script>
<script type="text/javascript"> 
	$(function(){   
	    var $li =$("#skin li");   
			$li.click(function(){   
			$("#"+this.id).addClass("selected").siblings().removeClass("selected");
			$("#cssfile").attr("href","__CSS__/"+ (this.id) +".css");   
	        $.cookie( "MyCssSkin" ,  this.id , { path: '/', expires: 10 });  
	        $('iframe').contents().find('#cssfile2').attr("href","__CSS__/"+ (this.id) +".css"); 
	    });   
	
	    var cookie_skin = $.cookie( "MyCssSkin");   
	    if (cookie_skin) {   
			$("#"+cookie_skin).addClass("selected").siblings().removeClass("selected");
			$("#cssfile").attr("href","__CSS__/"+ cookie_skin +".css"); 
			$.cookie( "MyCssSkin" ,  cookie_skin  , { path: '/', expires: 10 }); 
	    }   
	});
	function addFavorite(url, title) {
		try {
			window.external.addFavorite(url, title);
		} catch (e){
			try {
				window.sidebar.addPanel(title, url, '');
	        	} catch (e) {
				showDialog("请按 Ctrl+D 键添加到收藏夹", 'notice');
			}
		}
}
</script>

</head>
<body style="margin: 0px;" scroll="no">
<div id="pagemask"></div>
<div id="dialog" style="display:none">
  <div class="title">
    <h3>管理中心导航</h3>
    <span><a href="JavaScript:void(0);" onclick="closeBg();">关闭</a></span> </div>
  <div class="content">
  <volist name="menu" id="vo">
  <dl>	
  <dt>{$vo['module_title']}</dt>
  	<notempty name="vo['children']">
  	<volist name="vo['children']" id="v">
  	<dd><a href="javascript:void(0)" onclick="openItem('{$v['module_name']},{$v['module_action']},{$vo['module_action']}')">{$v['module_title']}</a></dd>
  	</volist>
  	</notempty>
  </dl>
  </volist>
  </div>
</div>
<table style="width: 100%;" id="frametable" height="100%" width="100%" cellpadding="0" cellspacing="0">
  <tbody>
    <tr>
      <td colspan="2" height="90" class="mainhd">
      <div class="layout-header">
          <div id="title"></div>
          <div id="topnav" class="top-nav">
            <ul>
              <li class="adminid" title="您好:<if condition="empty($admin['real_name'])">{$admin['user_name']}<else />{$admin['real_name']}</if>">您好:&nbsp;:&nbsp;<strong><if condition="empty($admin['real_name'])">{$admin['user_name']}<else />{$admin['real_name']}</if></strong></li>
              <li><a href="/admin/admin/updatePassword" target="workspace" ><span>修改密码</span></a></li>
              <li><a href="/admin/login/logout/" title="退出"><span>退出</span></a></li>
            </ul>
          </div>
          <nav id="nav" class="main-nav">
            <ul>
            <volist name="menu" id="vo">
            	<li><a class="<notempty name='vo.current'>link actived<else />link</notempty>" id="nav_{$vo['module_action']}" href="javascript:;" onclick="openItem('{$vo['module_action']}');"><span>{$vo['module_title']}</span></a></li>
            </volist>
            </ul>
          </nav>
          <div class="loca"><strong>您的位置:</strong>
            <div id="crumbs" class="crumbs"><span>控制台</span><span class="arrow">&nbsp;</span><span>欢迎页面</span> </div>
          </div>
          <div class="toolbar">
            <ul id="skin" class="skin"><span>换肤</span>
              <li id="skin_0" class="" title="默认风格"></li>
              <li id="skin_1" class="" title="Mac风格"></li>
            </ul>
            <div class="sitemap"><a id="siteMapBtn" href="#rhis" onclick="showBg('dialog','dialog_content');"><span>管理地图</span></a></div>
            <div class="toolmenu"><span class="bar-btn"></span>
              <ul class="bar-list">
                <li><a onclick="openItem('cache,index,setting');" href="javascript:void(0)">更新站点缓存</a></li>
                <li><a href="/admin/index/index/" id="iframe_refresh">刷新管理中心</a></li>
                <li><a href="/admin/index/index/" title="{:C('SITE_NAME')}-管理中心" rel="sidebar" onclick="addFavorite('/admin/index/index/', '{:C('SITE_NAME')}-管理中心');return false;">收藏管理中心</a></li>
              </ul>
            </div>
          </div>
        </div>
        <div > </div></td>
    </tr>
	<tr>
		<td class="menutd" valign="top" width="161">
			<div id="mainMenu" class="main-menu">
  <volist name="menu" id="vo">			
	<ul id="sort_{$vo['module_action']}">
		<li><dl><dd><ol>
	  	<notempty name="vo['children']">
	  	  	<volist name="vo['children']" id="v">
			<li nc_type=''><a href="JavaScript:void(0);" name="item_{$v['module_name']}{$v['module_action']}" id="item_{$v['module_name']}{$v['module_action']}" onclick="openItem('{$v['module_name']},{$v['module_action']},{$vo['module_action']}');">{$v['module_title']}</a></li>
	  	</volist>
	  	</notempty>					
		</ol></dd></dl></li>
	</ul>
  </volist>
			</div>
			<div class="copyright">
				<p>Powered By <em><a href="{:C('SITE_URL')}" target="_blank">{:C('SITE_NAME')}</a></em></p>
				<p>&copy;2015-2016 <a href="{:C('SITE_URL')}" target="_blank">{:C('SITE_NAME')} Inc.</a></p>
			</div>
		</td>
		<td valign="top" width="100%"><iframe src="" id="workspace" name="workspace" style="overflow: visible;" frameborder="0" width="100%" height="100%" scrolling="yes" onload="window.parent"></iframe></td>
	</tr>
		</tbody>
</table>
</body>
</html>
